#!/bin/bash
# deploy service

# env
export CATALINA_OPTS="-Djava.security.egd=file:/dev/./urandom"

module_name=$1
profile=$2
service_name=`echo ${module_name} | cut -d - -f 1`

# update source code
cd /root/workspace/${service_name}
git pull

# compile
/usr/local/maven/bin/mvn clean install package -P${profile} -U -Dmaven.test.skip=true

# deploy
rm /data/service/${module_name}.jar
cp /root/workspace/${service_name}/${module_name}/target/${module_name}.jar /data/service/

# restart server
sh -x /root/workspace/deploy/restart_service.sh ${module_name}




